package com.how2java.service.impl;

import java.util.List;

import com.how2java.dao.interfaces.IProductDAO;
import com.how2java.pojo.Product;
import com.how2java.service.interfaces.IProductService;

public class ProductServiceImpl implements IProductService{

	IProductDAO IProductDAO;
	public List<Product> list() {
		List<Product> products= IProductDAO.list();
		if(products.isEmpty()){
			for (int i = 0; i < 5; i++) {
				Product p = new Product();
				p.setName("product " + i);
				IProductDAO.add(p);
				products.add(p);
			}
		}
		return products;
	}

	public IProductDAO getIProductDAO() {
		return IProductDAO;
	}

	public void setIProductDAO(IProductDAO IProductDAO) {
		this.IProductDAO = IProductDAO;
	}

	public int delete() {
		// TODO Auto-generated method stub
		return 0;
	}

}
